package interator;

public class Student {

    private String name;
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public static Builder build(){
        return new Builder();
    }

    public static class Builder{

        private Student student= new Student();

        public Builder name(String name){
            student.setName(name);
            return this;
        }

        public Builder age(Integer age){
            student.setAge(age);
            return this;
        }

        public Student create(){
            return student;
        }

    }

    @Override
    public String toString() {
        return "Student{" + "name='" + name + '\'' + ", age=" + age + '}';
    }
}
